<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>数据库管理</title>
<script type="text/javascript" src="/j-tool/jquery.js"></script>
<link href='/public/css/admins.css' rel='stylesheet' type='text/css'/>
<body>
	<div class='bread'>评论管理</div>
	<div class="manageBox">
		<div class="formBox">
			<form method="post" name="psource" action="" onsubmit="return false;"> 
				<table class="searchBox">
					<tr>
						<td>发件人：</td><td><input type="text" name="name" class="input-text"/></td>
					</tr>
					<tr>
						<td>状态：</td><td><input type="text" name="status" class="input-text"/></td>
					</tr>
					<tr>
						<td>内容：</td><td><input type="text" name="content" class="input-text"/></td>
					</tr>
					<tr>
						<td>时间段：</td>
						<td><input type="text" name="stime" class="input-text" value="<!--{$tomorrow|date_format:'%Y-%m-%d'}-->" style="width:81px;text-align:center;"/>&nbsp;--&nbsp;<input type="text" name="etime" class="input-text" value="<!--{$lastmonth|date_format:'%Y-%m-%d'}-->" style="width:82px;text-align:center;"/></td>
					</tr>
					<tr>
						<td></td>
						<td><input type="submit" value="查询" class="butt" onclick="msearch();"/>&nbsp;&nbsp;&nbsp;&nbsp;标记为：&nbsp;&nbsp;<a href="JavaScript:;" onclick="dealWith('pass')">已审核</a>&nbsp;|&nbsp;<a href="JavaScript:;" onclick="dealWith('unpass')">未审核</a>&nbsp;|&nbsp;<a href="JavaScript:;" onclick="dealWith('dele')">删除</a></td>
					</tr>
				</table>
			</form>
			<div class="clear"></div>
		</div>
		<div class="infolist">
			<ul><li class="w5"><a href="javascript:;" onclick="choseAll();">全选</a></li><li class="w15">发件人</li><li class="w5">类型</li><li class="w40">内容</li><li class="w15">时间</li><li>状态</li></ul>
			<div class="result">
			<!--{foreach from=$data item=v}-->
				<!--{foreach from=$v item=val}-->
				<ul>
					<li class="w5"><input type="checkbox" name="chose[<!--{$val.id}-->]" value="<!--{$val.id}-->"/></li>
					<li class="w15"><a href="javascript:;" title="<!--{$val.address}-->"><!--{if $val.uid}--><!--{$val.uname|substr:0:6:false}--><!--{else}-->游客(<!--{$val.ip}-->)<!--{/if}--></a></li>
					<li class="w5"><!--{if $val.tid}-->留言<!--{else}--><font color='#BCC7CE' size="1">回复</font><!--{/if}--></li>
					<li class="w40"><a href="javascript:;" title="<!--{$val.content}-->"><!--{$val.content|substr:0:30}--></a></li>
					<li class="w15"><!--{$val.addtime}--></li>
					<li><!--{if $val.status eq 2}--><font color='red'>未审核</font><!--{else $val.status eq 1}--><font color='green'>已审核</font><!--{/if}--></li>
				</ul>
				<!--{/foreach}-->
			<!--{/foreach}-->
			</div>
		</div>
	</div>
</body>
<script type="text/javascript" src="/j-tool/admins.js"></script>
<script type="text/javascript">
	function dealWith(does)
	{	
		$.ajax({
		   type: "POST",
		   url: "admins_ajax.php",
		   data: 'action=cmt_'+does+'&'+$("input:checked").serialize(),
		   success: function(msg){
				msg == 'OK'?location.reload():alert(msg);;				
		   }
		});
	}
	function msearch()
	{
		$.ajax({
		   type: "POST",
		   url: "admins_ajax.php",
		   data: 'action=cmt&'+$("form").serialize(),
		   success: function(msg){
				if(msg !='null')
				{
					var data = $.parseJSON(msg),html='';
					for(var i=0;i<data.length;i++)
					{
						html += '<ul><li class="w5"><input type="checkbox" name="chose['+data[i].id+']" value="'+data[i].id+'"/></li><li class="w15"><a href="javascript:;" title="'+data[i].address+'">'+(data[i].uid!=0 ? data[i].uname.substr(0,6) : "游客("+data[i].ip+")")+'</a></li><li class="w5">'+(data[i].tid!=0?"留言":"<font color=#BCC7CE size=1>回复</font>")+'</li><li class="w40"><a href="javascript:;" title="'+data[i].content+'">'+data[i].content.substr(0,30)+'</a></li><li class="w15">'+data[i].addtime+'</li><li>'+(data[i].status==2?"<font color=red>未审核</font>":"<font color=green>已审核</font>")+'</li></ul>';
					}
					$('.result').html(html);
				}else{
					alert('没有找到相关数据');
				}			
		   }
		});
	}
</script>
</html>